package com.depin.pdaapp.activity;


import android.view.View;
import android.widget.LinearLayout;

import com.depin.pdaapp.R;
import com.jaydenxiao.common.base.BaseActivity;
import com.vondear.rxtool.RxSPTool;

import butterknife.BindView;
import butterknife.OnClick;

import static com.depin.pdaapp.constant.Constant.LOGINTYPE;

public class MainActivity extends BaseActivity {


    @BindView(R.id.lin_scan_in_em)
    LinearLayout linScanInEm;
    @BindView(R.id.lin_scan_out_em)
    LinearLayout linScanOutEm;
    @BindView(R.id.lin_zonghe_em)
    LinearLayout linZongheEm;
    @BindView(R.id.lin_wuliu_em)
    LinearLayout linWuliuEm;
    @BindView(R.id.lin_employ)
    LinearLayout linEmploy;
    @BindView(R.id.lin_wuliu)
    LinearLayout linWuliu;
    @BindView(R.id.lin_zhutao)
    LinearLayout linZhutao;
    @BindView(R.id.lin_pici)
    LinearLayout linPici;

    @BindView(R.id.lin_scan_in)
    LinearLayout linScanIn;
    @BindView(R.id.lin_scan_out)
    LinearLayout linScanOut;
    @BindView(R.id.lin_zonghe)
    LinearLayout linZonghe;
    @BindView(R.id.lin_manager)
    LinearLayout linManager;

    @Override
    public int getLayoutId() {
        return R.layout.activity_main;
    }

    @Override
    public void initPresenter() {

    }

    @Override
    public void initView() {
        switch (RxSPTool.getInt(this, LOGINTYPE)) {
            case 1:
                linEmploy.setVisibility(View.GONE);
                linManager.setVisibility(View.VISIBLE);
                break;
            case 2:
                linEmploy.setVisibility(View.VISIBLE);
                linManager.setVisibility(View.GONE);
                break;
        }

    }


    @OnClick({R.id.lin_scan_in_em, R.id.lin_scan_out_em, R.id.lin_zonghe_em, R.id.lin_wuliu_em, R.id.lin_wuliu, R.id.lin_zhutao, R.id.lin_pici, R.id.lin_scan_in, R.id.lin_scan_out, R.id.lin_zonghe})
    public void onViewClicked(View view) {
        switch (view.getId()) {

            case R.id.lin_scan_in:
            case R.id.lin_scan_in_em:
                ScanInActivity.start(this, 1);
                break;
            case R.id.lin_scan_out:
            case R.id.lin_scan_out_em:
                ScanInActivity.start(this, 2);
                break;
            case R.id.lin_zonghe:
            case R.id.lin_zonghe_em:
                startActivity(ZHActivity.class);
                break;
            case R.id.lin_wuliu:
            case R.id.lin_wuliu_em:
                WuliuActivity.start(this, 1);
                break;
            case R.id.lin_zhutao:
                startActivity(ZhuTaoActivity.class);
                break;
            case R.id.lin_pici:
                startActivity(PiciActivity.class);
                break;

        }
    }
}